\documentclass[a4paper]{article}
\usepackage{pgfplots}
\usepackage{pgfplots.assert}

\begin{document}

\tracingcommands=2\tracingmacros=2

\def\test#1#2{%
	\def\y{}%
	\pgfplotsforeachungrouped\x in{#1}{%
		\ifx\y\empty
			\xdef\y{\x}%
		\else
			\xdef\y{\y,\x}%
		\fi
	}%
	\pgfplotsassertequalstok{#2}{\y}{}%
}


\test{-2e0,...,2.0e0}{-2,-1,0,1,2}

\test{-2,...,2,5}{-2,-1,0,1,2,5}

\test{-2e0}{-2e0}

{
\pgfkeys{/pgf/fpu}
\test{-2e5,-1e5,...,2.0e5}{2Y2.0e5],2Y1.0e5],0Y0.0e3],1Y1.0e5],1Y2.0e5]}
}


\end{document}
